Skip to content

Add a formatter - #100

Merged
Rigidity merged 21 commits into
mainfrom
fmt
Jul 26, 2026
Merged

Add a formatter#100
Rigidity merged 21 commits into
mainfrom
fmt

Conversation

@Rigidity

@Rigidity Rigidity commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Note

Medium Risk
Large new formatter surface area and a behavioral change to glob vs named import resolution; risk is mitigated by extensive formatter tests and CI formatting checks rather than security-critical paths.

Overview
Introduces a new rue-formatter crate (0.10.0 workspace bump) that canonicalizes Rue source via the typed AST and rowan token stream, with rustfmt-like defaults, import/path reordering, comment ownership checks, and idempotent output verified by reparse.

CLI & tooling: rue fmt accepts paths/globs and --check, resolves FormatOptions from Rue.toml ([formatter] / max_width, indent_width). CI adds a Rue fmt step on examples, tests, and std .rue files. rue-tests can fail or update when the formatting corpus drifts.

LSP: document formatting returns a full-file TextEdit using the same format_source path.

Supporting changes: AstNodeKind in rue-ast (exhaustive node kinds + tests); binary_binding_power on parser SyntaxKind; import resolution sorts imports and skips glob symbols when a named import in the same scope already targets that name; std sources and a few compiler .rue files are reformatted to match the new style.

Reviewed by Cursor Bugbot for commit 02f7ba2. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread crates/rue-formatter/src/ordering.rs
Comment thread crates/rue-formatter/src/ordering.rs

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bee7844. Configure here.

Comment thread crates/rue-compiler/src/compile/imports.rs
@Rigidity
Rigidity merged commit 46168be into main Jul 26, 2026
2 checks passed
@Rigidity
Rigidity deleted the fmt branch July 26, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant